<?php
/**
 * Created by PhpStorm.
 * User: 戎大富
 * Date: 2019/6/12
 * Time: 14:47
 */
namespace app\admin\controller;
use think\Db;
class Total extends Base {
    public function index(){
        $time = date('Y-m-d');
        $where['revenue_status'] = 1;
        $res1 = Db::table('up_revenue')->where($where)->sum('revenue_glod');
        $res2 = Db::table('up_revenue')->where($where)->sum('revenue_price');
        $this->assign('res1',$res1);
        $this->assign('res2',$res2);
        return $this->fetch();
    }

    public function broken(){
        $start  = input('param.add_start');
        $end  = input('param.add_end');
        $where['revenue_time'] = array('between',array($start,$end));
        $where['revenue_status'] = 1;
        $res1 = Db::table('up_revenue')->where($where)->sum('revenue_glod');
        $res2 = Db::table('up_revenue')->where($where)->sum('revenue_price');
        return json(['code' => 200, 'msg' => $res1,'msg1'=>$res2]);
    }
}